$SAVE
$NOLIST
;************************************************************************
;*									*
;*    R T X - 51  :  DEBUG MACROS                                       *
;*							     		*
;*----------------------------------------------------------------------*
;*                                                                      *
;*    Filename     :   RTXDEBUG.INC                                     *
;*    Language     :   Keil A-51 (A51.EXE V4.4)                         *
;*    Dev. system  :   Keil uVision2                                    *
;*    Targetsystem :   Any system based upon 8051 up                    *
;*                                                                      *
;*    Purpose      :   Macro definitions for debug functions. To be     *
;*                     used as an include file.                         *
;*								     	*
;*----------------------------------------------------------------------*
;* Rev. |  Released   | Programmer    | Comments                        *
;*----------------------------------------------------------------------*
;*  0.1 |  9.1.1991   | E. Glatz      | File created                    *
;*  0.2 |  7.3.1991   | Th. Fischler  | Adapted to Keil A-51            *
;*      | 11.4.1991   | Th. Fischler  | Changes for V4.0                *
;* 7.00 | 13.11.2001  | T. Mueller    | Release 7.00                    *
;************************************************************************
;*    Copyright 1991 .. 2001 METTLER  &  FUCHS  AG,  CH-8953 Dietikon   *
;************************************************************************

DBG_SYS_ENTRY  MACRO
;;
;;      Activate Indicator for System Operation
;;      ---------------------------------------
;;      To be used at system entry.
;;
         $IF (DBG = 01H)
            SETB    SYSOP_FLAG            ; *** Sysop_flag := on
         $ENDIF
         ENDM



DBG_SYS_EXIT   MACRO
;;
;;      Deactivate Indicator for System Operation
;;      -----------------------------------------
;;      To be used at system exit.
;;
         $IF (DBG = 01H)
            CLR     SYSOP_FLAG            ; *** Sysop_flag := off
         $ENDIF
         ENDM



DBG_UNLOCK_DRV MACRO
               LOCAL DONE
;;
;;      Deactivate Indicator for Driver Interrupt Locking
;;      -------------------------------------------------
;;      To be used when executing ALLOW_DRV_INT or ALLOW_INT.
;;
         $IF (DBG = 01H)
            JB      ?RTX_RUNNING_TID.4, DONE
            CLR     LOCK_FLAG             ; *** Lock_flag := off
         $ENDIF
DONE:
         ENDM


DBG_LOCK_DRV   MACRO
;;
;;      Activate Indicator for Driver Interrupt Locking
;;      -----------------------------------------------
;;      To be used when executing EXCLUDE_INT.
;;
         $IF (DBG = 01H)
            SETB      LOCK_FLAG           ; *** Lock_flag := on
         $ENDIF
         ENDM



DBG_BUSY       MACRO
;;
;;      Activate Busy Indicator
;;      -----------------------
;;      To be used whenever exiting idle state.
;;
         $IF (DBG = 01H)
            SETB    BUSY_FLAG             ; *** Busy_flag := on
         $ELSEIF (DBG = 02H)
            SETB    BUSY_FLAG             ; *** Busy-flag := on
         $ENDIF
         ENDM



DBG_IDLE       MACRO
;;
;;      Deactivate Busy Indicator
;;      -------------------------
;;      To be used whenever entering idle state.
;;
         $IF (DBG = 01H)
            CLR     BUSY_FLAG             ; *** Busy_flag := off
         $ELSEIF (DBG = 02H)
            CLR     BUSY_FLAG             ; *** Busy-flag := off
         $ENDIF
         ENDM



DBG_CLKINT_ENTRY  MACRO
;;
;;      Activate Indicator for System Clock Operation
;;      ---------------------------------------------
;;      To be used when entering system clock handler.
;;
         $IF (DBG = 01H)
            SETB    CLOCK_FLAG            ; *** clock_flag := on
         $ENDIF
         ENDM


DBG_CLKINT_EXIT   MACRO
;;
;;      Deactivate Indicator for System Clock Operation
;;      -----------------------------------------------
;;      To be used when exiting system clock handler.
;;
         $IF (DBG = 01H)
            CLR     CLOCK_FLAG            ; *** clock_flag := off
         $ENDIF
         ENDM

$RESTORE
